]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
tests: Add test running basic perf test
authorJonas Ådahl <jadahl@gmail.com>
Wed, 17 Aug 2022 14:43:13 +0000 (16:43 +0200)
committerJonas Ådahl <jadahl@gmail.com>
Fri, 25 Nov 2022 21:09:53 +0000 (22:09 +0100)
This test runs all of GNOME Shell using the headless backend inside a
mocked D-Bus environment. The basic test tests, well, basic things, like
the panel menu, the overview, showing the app grid view, as well as
going back to the session view.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1349>

.gitlab-ci.yml
data/meson.build
js/ui/scripting.js
src/meson.build
tests/meson.build

index c712bc586616e8958e1d7b0f3d48c552c0e5e76c..346558233bd0c74c98a3a3ff981f8e7576e1fd1b 100644 (file)
@@ -209,6 +209,7 @@ test:
     NO_AT_BRIDGE: "1"
   before_script:
     - meson install -C mutter/build
+    - mkdir -m 700 $XDG_RUNTIME_DIR
   script:
     - dbus-run-session -- xvfb-run meson test -C build --no-rebuild
   artifacts:
index 30d4917d8e9320ea603dd85dfd30ddcc96d75b4e..7fa7f15ffb3d0a816f59630afe872df2841afdfb 100644 (file)
@@ -1,3 +1,5 @@
+data_builddir = meson.current_build_dir()
+
 desktop_files = [
   'org.gnome.Shell.desktop',
   'org.gnome.Shell.Extensions.desktop',
@@ -134,5 +136,5 @@ endif
 custom_target('compile-schemas',
   input: schema,
   output: 'gschemas.compiled',
-  command: [find_program('glib-compile-schemas'), meson.current_build_dir()],
+  command: [find_program('glib-compile-schemas'), data_builddir],
   build_by_default: true)
index cbd6ecd6b0e2d4e75fad65fbaf694807087407c1..4034d21051beb18ca615e5c9a9cf285d758c3d9a 100644 (file)
@@ -77,7 +77,7 @@ function _getPerfHelper() {
 }
 
 function _spawnPerfHelper() {
-    let path = Config.LIBEXECDIR;
+    let path = GLib.getenv('GNOME_SHELL_BUILDDIR') || Config.LIBEXECDIR;
     let command = `${path}/gnome-shell-perf-helper`;
     Util.trySpawnCommandLine(command);
 }
index fc7f8bfcce0d94e6b5032d00addfe0f26e2b60e2..de88a45d9d9b401c36fdd48c2fb4e62fb2463588 100644 (file)
@@ -1,3 +1,5 @@
+src_builddir = meson.current_build_dir()
+
 service_data = configuration_data()
 service_data.set('libexecdir', libexecdir)
 
@@ -16,20 +18,21 @@ script_data.set('pkglibdir', pkglibdir)
 script_data.set('PYTHON', python.full_path())
 script_data.set('VERSION', meson.project_version())
 
-script_tools = ['gnome-shell-perf-tool']
+perf_tool = configure_file(
+  input: 'gnome-shell-perf-tool.in',
+  output: 'gnome-shell-perf-tool',
+  configuration: script_data,
+  install_dir: bindir
+)
 
 if get_option('extensions_tool')
-  script_tools += 'gnome-shell-extension-tool'
-endif
-
-foreach tool : script_tools
   configure_file(
-    input: tool + '.in',
-    output: tool,
+    input: 'gnome-shell-extension-tool.in',
+    output: 'gnome-shell-extension-tool',
     configuration: script_data,
     install_dir: bindir
   )
-endforeach
+endif
 
 install_data('gnome-shell-extension-prefs',
   install_dir: bindir
index 72ac6170c20bf7ca5c5e69fe29d7708f8d422f4f..8c020286132163b046ce56620e4da15e764486d5 100644 (file)
@@ -38,3 +38,29 @@ foreach test : tests
     env: testenv,
     workdir: meson.current_source_dir())
 endforeach
+
+perf_tests = [
+  'basic',
+]
+
+gvc_typelib_path = fs.parent(libgvc.get_variable('libgvc_gir')[1].full_path())
+libgvc_path = fs.parent(libgvc.get_variable('libgvc').full_path())
+
+perf_testenv = testenv
+perf_testenv.set('G_DEBUG', 'fatal-criticals')
+perf_testenv.set('G_MESSAGES_DEBUG', 'GNOME Shell')
+perf_testenv.set('GNOME_SHELL_DATADIR', data_builddir)
+perf_testenv.set('GNOME_SHELL_BUILDDIR', src_builddir)
+perf_testenv.append('GI_TYPELIB_PATH', gvc_typelib_path, separator: ':')
+perf_testenv.append('LD_LIBRARY_PATH', libgvc_path, separator: ':')
+
+foreach perf_test : perf_tests
+  test('perf-' + perf_test, dbus_runner,
+    args: [
+      perf_tool,
+      '--headless',
+      '--perf=@0@'.format(perf_test),
+    ],
+    env: perf_testenv,
+  )
+endforeach